/**
 * 
 */
package edu.cmu.mism.dgjava.utils;

import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;

/**
 * @author Ankit
 *
 */
public class UIUtility {
	

	public static TableViewer createTableViewer(Composite container, String[] columnNames) {
		
		Table viewTable = new Table(container, SWT.SINGLE | SWT.BORDER
				| SWT.H_SCROLL | SWT.V_SCROLL );
		GridData hGd = new GridData(SWT.FILL, SWT.FILL, true, true);
		
		viewTable.setLayoutData(hGd);
		viewTable.setHeaderVisible(true);
		TableViewer _tableViewer = new TableViewer(viewTable);
		
		for (String columnName : columnNames) {
			
			TableColumn timeColumn = new TableColumn(viewTable, SWT.NONE);
			timeColumn.setText(columnName);
			timeColumn.setWidth(100);
		}

		return _tableViewer;
	}

}
